<template>
	<view>
		<mycollectlist-components :data="mycollectlist" @clickItem="getDetail"></mycollectlist-components>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				mycollectlist: [],
				page: 0,
				page_size: 10,
			}
		},
		methods: {
			getData() {
				console.log(this.page + ":" + this.page_size);
				// + '&page_size=' + this.page_size
				this.$u.get('/lg/collect/list/0/json?curPage=' + this.page + '&page_size=' + this.page_size).then((res) => {
					// res.article.forEach((item) => {
					// 	// item.coverImg = decodeURIComponent(item.bookCover[0]).replace('/agent/', '');
					// 	item.coverImg = decodeURIComponent(item.cover).replace('/agent/', '')
					// })
					// this.articlelist = [...this.articlelist, ...res.data.datas]
					this.mycollectlist = [...this.mycollectlist, ...res.data.datas]
					console.log('成功');
					// console.log('pageIndex:'+this.pageIndex);
				}).catch((res) => {
					console.log('失败');
				})

			},
			onLoad: function(option) {
				// this.page = option.page;
				// this.page_size = option.page_size;
				// this.articlelist = option.articlelist;
				this.getData();
			},
			onPullDownRefresh() {
				console.log('触发下拉刷新')
				this.page = 0;
				this.page_size = 10;
				this.articlelist = [];
				this.getData();
				setTimeout(function() {
					uni.stopPullDownRefresh();
				}, 1000);
			},
			onReachBottom() {
				this.page++;
				// this.page_size = this.page_size + 10;
				this.getData();
			}
		}
	}
</script>

<style>

</style>
